package com.doit.demo02;

import java.util.concurrent.atomic.AtomicInteger;

public class test {
    public static void main(String[] args) {
        AtomicInteger ai = new AtomicInteger(10);
        //AtomicInteger AtomicInteger AtomicInteger AtomicInteger AtomicInteger
        //AtomicInteger AtomicInteger AtomicInteger
        ai.getAndIncrement();//10++
        ai.incrementAndGet();//++11
        System.out.println(ai);//12

        System.out.println(ai.getAndIncrement());//12++  先使用后加
        System.out.println(ai);//13

        System.out.println(ai.incrementAndGet());//++13  先加后使用
        System.out.println(ai);//14

        System.out.println(ai.get());//获取值
        System.out.println(ai.intValue());//获取int类型的值

        System.out.println(ai.getAndAdd(100));//先使用后加
        System.out.println(ai);//114

        System.out.println(ai.addAndGet(100));//先加后使用
        System.out.println(ai);
    }
}
